package io.zhiller.simpletemplate.api.git_repository

import com.fasterxml.jackson.annotation.JsonProperty

interface GitApiDefines {
  suspend fun getAllReleases(
    owner: String, repo: String, page: Int = 1, perPage: Int = 100
  ): List<ReleaseDTO>
}

// DTO Classes
data class ReleaseDTO(
  @JsonProperty("id") val id: Int,
  @JsonProperty("tag_name") val tagName: String,
  @JsonProperty("target_commitish") val targetCommitish: String,
  @JsonProperty("prerelease") val prerelease: Boolean,
  @JsonProperty("name") val name: String,
  @JsonProperty("body") val body: String,
  @JsonProperty("author") val author: AuthorDTO,
  @JsonProperty("created_at") val createdAt: String,
  @JsonProperty("assets") val assets: List<AssetDTO>
)

data class AuthorDTO(
  @JsonProperty("id") val id: Int,
  @JsonProperty("login") val login: String,
  @JsonProperty("name") val name: String,
  @JsonProperty("avatar_url") val avatarUrl: String,
  @JsonProperty("url") val url: String,
  @JsonProperty("html_url") val htmlUrl: String,
  @JsonProperty("remark") val remark: String,
  @JsonProperty("followers_url") val followersUrl: String,
  @JsonProperty("following_url") val followingUrl: String,
  @JsonProperty("gists_url") val gistsUrl: String,
  @JsonProperty("starred_url") val starredUrl: String,
  @JsonProperty("subscriptions_url") val subscriptionsUrl: String,
  @JsonProperty("organizations_url") val organizationsUrl: String,
  @JsonProperty("repos_url") val reposUrl: String,
  @JsonProperty("events_url") val eventsUrl: String,
  @JsonProperty("received_events_url") val receivedEventsUrl: String,
  @JsonProperty("type") val type: String
)

data class AssetDTO(
  @JsonProperty("browser_download_url") val browserDownloadUrl: String,
  @JsonProperty("name") val name: String
)

